﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace Ring2Park.Models
{
    public class ParkingSession
    {
        [Key]
        public int ParkingSessionId { get; set; }

        // set by system
        public string UserName { get; set; }

        [Display(Name = "Location")]
        [Required(ErrorMessage = "A Parking Location is required.")]
        public int ParkingLocationId { get; set; }

        [Display(Name = "Vehicle")]
        [Required(ErrorMessage = "A Vehicle is required.")]
        public int VehicleId { get; set; }

        [Display(Name = "Start Date")]
        [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
        [Required(ErrorMessage = "A start date is required.")]
        public DateTime StartDate { get; set; }

        [Display(Name = "Duration (days)")]
        [Range(1, 31, ErrorMessage = "Number of days duration must be between 1 and 31.")]
        [Required(ErrorMessage = "A duration is required.")]
        public int Duration { get; set; }

        public virtual ParkingLocation ParkingLocation { get; set; }
        public virtual Vehicle Vehicle { get; set; }
    }
}